package com.csun.cmny.provider.model.enums.rfid;

import com.csun.cmny.provider.model.enums.device.DmcDeviceStatusEnum;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-12-09 14:26
 * @Description:
 */
public enum DmcRfidLabelRoleCodeEnum {

    /**
     * Enable uac user status enum.
     */
    /*
     * 绑定老人
     */
    OLDMAN("oldman", "绑定老人"),
    /**
     * 绑定员工
     */
    EMP("emp", "绑定用户"),
    /**
     * 绑定员工
     */
    OTHER("other", "其他"),;

    /**
     * The Key.
     */
    String key;
    /**
     * The Value.
     */
    String value;

    DmcRfidLabelRoleCodeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * Gets key.
     *
     * @return the key
     */
    public String getKey() {
        return key;
    }

    /**
     * Gets value.
     *
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * 获取key获取value
     *
     * @param key key
     *
     * @return value value
     */
    public static String getValue(String key) {
        for (DmcRfidLabelRoleCodeEnum ele : DmcRfidLabelRoleCodeEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele.getValue();
            }
        }
        return null;
    }

    /**
     * 根据key获取该对象
     *
     * @param key key
     *
     * @return this enum
     */
    public static DmcRfidLabelRoleCodeEnum getEnum(String key) {
        for (DmcRfidLabelRoleCodeEnum ele : DmcRfidLabelRoleCodeEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele;
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<DmcRfidLabelRoleCodeEnum> getList() {
        return Arrays.asList(DmcRfidLabelRoleCodeEnum.values());
    }


    /**
     * 获取map类型集合
     *
     * @return Map类型List集合 map 2 list
     */
    public static List<Map<String, String>> getMap2List() {
        List<Map<String, String>> list = Lists.newArrayList();
        for (DmcRfidLabelRoleCodeEnum ele : DmcRfidLabelRoleCodeEnum.values()) {
            Map<String, String> map = Maps.newHashMap();
            map.put("key", ele.getKey());
            map.put("value", ele.getValue());
            list.add(map);
        }
        return list;
    }

}
